fix: subagent permissions bypass and Lost restrictions after compaction#21661
fix: subagent permissions bypass and Lost restrictions after compaction#21661nightguarder wants to merge 5 commits intoanomalyco:devfrom
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #18764: fix(opencode): preserve readonly subagent restrictions across compaction Reason: This PR directly addresses the same issue (#18213) mentioned in the current PR - preserving readonly restrictions after compaction. Both PRs are tackling permission preservation for subagents during compaction operations, which appears to be overlapping scope. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Issue for this PR
Plan mode restrictions bypassed when spawning sub-agents
Fixes #18213: Readonly restrictions lost after compaction
Fixes #6527: Sub-agent permission bypass in Plan mode
Type of change
What does this PR do?
Fixes sub-agent permission bypass: when spawning sub-agents from Plan mode, they now inherit the parent session's permissions (including
edit: deny). Previously, sub-agents ran with full permissions and could edit files despite Plan mode being active.task.ts- Gets caller agent permissions, merges with session, adds edit: deny if parent has it, updates persisted session permission (including resumed task_id sessions)prompt.ts- Merges tool-derived permissions with existing session rules instead of replacing thembash.ts- Detects output redirection (>, >>) and sed -i and requires edit permission for themIf you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
I ran
bun devand verified the project builds and startScreenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.